#include <iostream>
using namespace std;

class Date
{
	public :
		int m_year;
		int m_mon;
		int m_day;
	public :
		Date(int year = 2016, int mon = 5, int day = 29) :
			m_year(year), m_mon(mon), m_day(day)
		{}

		void display() const
		{
			cout << m_year << " - " << m_mon << " - " << m_day << endl;
		}
	protected :
};

class Check
{
	private :
		int book_id;
		string title;
		Date date_borrowed;
		Date date_due;
	public :
		Check(int id = 12, string t = "Walden", int y1 = 2016, int m1 = 5, int d1 = 30, int y2 = 2016, int m2 = 6, int d2 = 30) :
			book_id(id), title(t), date_borrowed(y1, m1, d1), date_due(y2, m2, d2)
		{
			cout << "<Check init()>" << endl;
		}

		friend istream& operator>>(istream& in, Check& c);
		friend ostream& operator<<(ostream& out, const Check& c);

	protected :
};

istream& operator>>(istream& in, Check& c)
{
	cout << "<My intput()>" << endl;
	in >> c.book_id >> c.title >> c.date_borrowed.m_year >> c.date_borrowed.m_mon >> c.date_borrowed.m_day >> c.date_due.m_year >> c.date_due.m_mon >> c.date_due.m_day;
	return in;
}

ostream& operator<<(ostream& out, const Check& c)
{
	out << "<My output()>" << endl << "Book_id : " << c.book_id << endl << "Title   : " << c.title << endl;
	cout << "Bor_t   : ";
	c.date_borrowed.display();
	cout << "Due_t   : ";
	c.date_due.display();
	return out;
}

int main()
{
	Check c;
	cout << c << endl;
	cin >> c;
	cout << c << endl;
}
